package cn.bulibuqi.controller;

import cn.bulibuqi.bean.Department;
import cn.bulibuqi.bean.Msg;
import cn.bulibuqi.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author bulibuqi
 * 处理和部门有关的请求
 * @create 2021-11-14:16
 */
@Controller
public class DepartmentController {

    @Autowired
    private DepartmentService departmentService;

    /**
     * 功能描述: <br>
     * 〈返回所有的部门信息〉
     * @Param:
     * @Return:
     * @Author: bulibuqi
     * @Date: 2021/11/28 14:18
     */
    @RequestMapping("/depts")
    @ResponseBody
    public Msg getDepts()
    {
        //查出的所有部门信息
      List<Department> list = departmentService.getDepts();
      return Msg.success().add("depts",list);

    }
}
